﻿using System;

namespace enyo
{
    public class Request : Component
    {
        //Note: Usually should not assign value
        //public Event onRequestSuccess;
        //public Event onRequestFailure;
        //public Event onRequestResponse;        

        /// <summary>
        /// Initiates the request.
        /// </summary>
        public virtual void Call()
        {
        }

        /// <summary>
        /// Called to determine if the response was a failure; usually overridden by specific Request types.
        /// </summary>
        /// <param name="response"></param>
        /// <returns></returns>
        public virtual bool IsFailure(object response)
        {
            return false;
        }

        /// <summary>
        /// Processes the request's response.
        /// </summary>
        /// <param name="response"></param>
        public virtual void Receive(object response)
        {
        }
    }
}
